



// const DIGITALS = ["buttonSouth", "buttonNorth",
//     "buttonWest", "buttonEast", "buttonL1", "buttonR1",
//     "buttonL2", "buttonR2", "buttonOptions", "Up", "Left", "Down", "Right", "buttonShare"];


import { BaseGamepadMgr } from "../core/BaseGamepadMgr";
import { HandleType } from "../core/GamepadDefine";
import { CCGamepadCtrl } from "./CCGamepadCtrl";


const ANALOGS = ["leftStick", "rightStick"];

const DIGITALS = [
    ["buttonSouth", "buttonNorth",
        "buttonWest", "buttonEast", "buttonL1", "buttonR1",
        "buttonL2", "buttonR2", "buttonOptions", "Up", "Left", "Down", "Right", "buttonShare"],
    [
        "buttonEast",
        "buttonWest",
        "buttonNorth",
        "buttonSouth",
        "buttonL1", "buttonR1",
        "buttonL2", "buttonR2", "buttonOptions", "Up", "Left", "Down", "Right", "buttonShare"]
];
//https://partner.steamgames.com/doc/api/isteaminput
export default class CCGamepadMgr extends BaseGamepadMgr {
    setHandleType(type: HandleType) {
        super.setHandleType(type);
        this._gameCtrl.clear()
        this._gameCtrl.init(DIGITALS[type], ANALOGS);
    }


    initController() {
        this._gameCtrl = new CCGamepadCtrl();
        this._gameCtrl.init(DIGITALS[this.getHandleType()], ANALOGS);
    }

    isActive() {
        return true;
    }

    clear() {
        this._gameCtrl.clear()
    }
}

